/*
 * @Descripttion: 
 * @version: 
 * @Author: ChenXiang
 * @Date: 2021-05-24 17:08:20
 * @LastEditors: ChenXiang
 * @LastEditTime: 2021-06-01 11:01:44
 */
const { data } = require("./data");
module.exports = [
    {
        type: 'get',
        url: '/demo/list/del',
        callback: ({ query }, res) => {
            const index = data.findIndex(f => f.id == query.id);
            if (index !== -1) {
                data.splice(index, 1)
            }
            res.jsonp({
                status: 'success',
                code: 200
            })
        }
    },
    {
        type: 'get',
        url: '/demo/list',
        callback: (req, res) => {
            res.jsonp({
                data,
                status: 'success',
                code: 200
            })
        }
    },
    {
        type: 'get',
        url: '/demo/list/info',
        callback: ({ query }, res) => {
            const find = data.find(item => item.id == query.id)
            res.jsonp({
                data: find,
                status: 'success',
                code: 200
            })
        }
    }
]
